package cn.edu.seu.cose.qol.model.dto.exception;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "exception")
public class ExceptionXmlObject {
	
	@XmlElement(name = "type")
	private String _exceptionType;
	
	@XmlElement(name = "message")
	private String _exceptionMsg;
	
	public ExceptionXmlObject() {
		_exceptionMsg = "an exception occurred";
	}
	
	public ExceptionXmlObject(Exception exception) {
		_exceptionType = exception.getClass().getName();
		_exceptionMsg = exception.getMessage();
	}
	
	public String getExceptionType() {
		return _exceptionType;
	}
	
	public String getExceptionMessage() {
		return _exceptionMsg;
	}

}
